Another way to create a Channel is via Channel().
This looks like a constructor, but Channel is an interface, not a class.
In reality, Channel() is simply a top-level factory function, sharing a name with the interface.
It takes a parameter indicating how send() should work:
0indicates thatsend()should block until the consumer of the channel is able to receive the objectChannel.UNLIMITEDmeans thatsend()always returns immediately, and the channel will buffer objects up until the limit of available memoryChannel.CONFLATEDmeans thatsend()always returns immediately, but only the last object sent is buffered — all previous objects are lostAny other positive
Intvalue (but less thanChannel.UNLIMITED) means that the channel will buffer that number of elements, andsend()might block until a consumer can receive objects if that buffer is full (Channel.BUFFEREDuses a default capacity of 64 elements)